package com.mezz.bones.im.common.event;

import com.mezz.bones.im.common.message.base.Message;
import com.mezz.bones.im.common.domain.user.ImUserConnectInfo;
import org.springframework.context.ApplicationEvent;

import java.io.Serializable;

/**
 * @Author: zhuang
 * @Date: 2024/12/2 13:41
 * @Description: 消息已接收事件 触发业务逻辑
 * @Version: 1.0
 **/

public class MessageReceivedEvent extends ApplicationEvent implements Serializable {

    /**
     * 消息发起者的客户端连接对象
     */
    private ImUserConnectInfo senderUserConnectInfo;
    private Message message;

    public MessageReceivedEvent(ImUserConnectInfo senderUserConnectInfo, Message message) {
        super(message);
        this.message = message;
        this.source = message.getHeader().getTraceId();
        this.senderUserConnectInfo = senderUserConnectInfo;
    }

    public Message getImMessage() {
        return message;
    }

    public ImUserConnectInfo getImUserInfo() {
        return senderUserConnectInfo;
    }

}
